VB 2010 LOGIN 3-TIMES LOOP [migrated]

Posted by stargaze07 on Programmers See other posts from Programmers or by stargaze07
Published on 2012-11-09T08:31:38Z Indexed on 2012/11/09 11:20 UTC
Read the original article Hit count: 167

Filed under:
|
|

How to put a loop on my log in code it's like the program will end if the user inputs a wrong password/username for the third time?

At this point I'm having a hard time putting the loop code.

This is my LogIn Code in VB 2010

Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
    Me.Refresh()
    Dim login = Me.TblUserTableAdapter1.UsernamePasswordString(txtUser.Text, txtPass.Text)

    If login Is Nothing Then
        MessageBox.Show("Incorrect login details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Else
        Dim ok As DialogResult
        ok = MessageBox.Show("Login Successful", "Dantiña's Catering Maintenance System", MessageBoxButtons.OK, MessageBoxIcon.Information)
        MMenu.Show()
        MMenu.lblName.Text = "Welcome " & Me.txtUser.Text & " !"
        If txtPass.Text <> "admin" Then
            MMenu.Button1.Enabled = False
            ProdMaintenance.GroupBox1.Visible = True
            MMenu.Button2.Enabled = True
            MMenu.Button3.Enabled = True
            MMenu.Button4.Enabled = True
        Else
            MMenu.Button1.Enabled = True
            ProdMaintenance.GroupBox1.Visible = True
            MMenu.Button2.Enabled = True
            MMenu.Button3.Enabled = True
            MMenu.Button4.Enabled = True
        End If
        Me.Refresh()
        Me.Hide()

    End If

End Sub

© Programmers or respective owner

Related posts about login

Related posts about visual-basic